const path = require("path");

const name = process.env["VUE_APP_TITLE "];
function resolve(dir) {
  return path.join(__dirname, dir);
}

module.exports = {
  publicPath: "./",
  lintOnSave: false,
  assetsDir: "static",
  indexPath: "index.html",
  productionSourceMap: false,
  devServer: {
    disableHostCheck: true,
    open: true,
    port: 8080,
    // 开发环境默认开启反向代理，如果不需要请自行注释
    proxy: {
      "/apis": {
        target: process.env.VUE_APP_ReqUrl,
        changeOrigin: true,
        ws: true,
        pathRewrite: {
          "/apis": process.env.VUE_APP_ReqUrl,
        },
      },
    },
  },
  css: {
    extract: false,
    sourceMap: false,
    modules: false,
    loaderOptions: {},
  },
  configureWebpack: {
    // provide the app's title in webpack's name field, so that
    // it can be accessed in index.html to inject the correct title.
    name: name,
    resolve: {
      alias: {
        "@": resolve("src"),
      },
    },
  },
};
